package top.zsyle.sycc.fallback;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import top.zsyle.sycc.doc.CourseDoc;
import top.zsyle.sycc.exception.GlobalExceptionEnum;
import top.zsyle.sycc.feign.EsCourseService;
import top.zsyle.sycc.result.JsonResult;

@Component
public class EsCourseServiceFallbackFactory implements FallbackFactory<EsCourseService> {

    @Override
    public EsCourseService create(Throwable throwable) {
        return new EsCourseService() {
            @Override
            public JsonResult save(CourseDoc courseDoc) {
                return JsonResult.error(GlobalExceptionEnum.ERROR.getMessage(),GlobalExceptionEnum.ERROR.getCode());
            }
        };
    }
}
